<?php
namespace Orm\Order;
class OrderList extends \Base\BaseOrmObjectLists{

    // for function keyBy()
    protected $key_by;

    function __construct()
    {
        parent::__construct();
        $this->dbo = new \Orm\Order\OrderModel();
        $this->filter = '`is_del` = 0';
        $this->order ='';
    }

    function newObj()
    {
        return new \Orm\Order\OrderClass();
    }

    /**
     * keyBy
     * @param  string $field
     * @return obj
     * @author imjcw
     * @date   2016-11-08
     */
    public function keyBy($field)
    {
        $this->key_by = $field;
        return $this;
    }

    /**
     * 完善订单详情
     * @param $order_ids
     * @return array
     */
    public function completeDetail($order_ids)
    {
        if (count($order_ids) ==0) return array();
        $order_detail_list = new \Orm\OrderDetail\OrderDetailList();
        $order_detail_list['limit'] = \Util\Config::get('max_limit');
        $order_detail_list['where'] = "order_id IN (".implode($order_ids,',') .")";
        $order_detail_list->load();
        return $order_detail_list['lists'];
    }

    public function userDetail($seller_uid)
    {
        if (count($seller_uid) ==0) return array();
        $user_detail_list = new \Orm\User\UserList();
        $user_detail_list['limit'] = \Util\Config::get('max_limit');
        $user_detail_list['where'] = "id IN (".implode($seller_uid,',') .")";
        $user_detail_list->load();
        return $user_detail_list['lists'];
    }
}